import tkinter
from tkinter import simpledialog

top = tkinter.Tk()
top.title("课程展示")
top.geometry("600x600")

# 用于显示输入信息的标签
unit_label = tkinter.Label(top, text="")
unit_label.pack()
name_label = tkinter.Label(top, text="")
name_label.pack()
job_label = tkinter.Label(top, text="")
job_label.pack()
contact_label = tkinter.Label(top, text="")
contact_label.pack()
address_label = tkinter.Label(top, text="")
address_label.pack()

def get_info():
    global unit_label, name_label, job_label, contact_label, address_label
    # 获取单位
    unit = simpledialog.askstring("输入", "请输入单位：")
    unit_label.config(text=f"单位: {unit}")
    # 获取姓名
    name = simpledialog.askstring("输入", "请输入姓名：")
    name_label.config(text=f"姓名: {name}")
    # 获取职务
    job = simpledialog.askstring("输入", "请输入职务：")
    job_label.config(text=f"职务: {job}")
    # 获取联系方式
    contact = simpledialog.askstring("输入", "请输入联系方式：")
    contact_label.config(text=f"联系方式: {contact}")
    # 获取联系地址
    address = simpledialog.askstring("输入", "请输入联系地址：")
    address_label.config(text=f"联系地址: {address}")


# 按钮，点击后弹出对话框获取信息
button = tkinter.Button(top, text="输入信息", command=get_info)
button.pack()

top.mainloop()
